portable-ruby: inline validation into test-bot, automate brew updates#22393
Conversation
There was a problem hiding this comment.
Pull request overview
This PR shifts portable-ruby validation earlier into test-bot so the newly built portable-ruby bottle is exercised against Homebrew/brew’s own PR-gating checks during the homebrew-core bottle build, and it replaces the manual brew update-portable-ruby dev-cmd with an automated workflow that opens a brew bump PR when a portable-ruby bottle is published.
Changes:
- Extend
test-bot’sportable_formula!path to stage the builtportable-rubybottle, runbrew vendor-install ruby, and then run brew’s PR validation surface. - Add
Utils::PortableRuby.sync_bundler_version!helper and use it from test-bot/workflow to keeputils/ruby.shbundler version in sync with the vendored portable Ruby. - Remove the
update-portable-rubydev-cmd/spec/RBI and add abump-portable-ruby.ymlworkflow to open an automated brew bump PR.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
Library/Homebrew/utils/portable_ruby.rb |
New helper for syncing bundler version based on the vendored portable Ruby contents. |
Library/Homebrew/test_bot/formulae.rb |
Adds portable-ruby-specific post-bottle validation steps and threads args through portable_formula!. |
Library/Homebrew/dev-cmd/update-portable-ruby.rb |
Removes the dev-cmd in favor of automation. |
Library/Homebrew/test/dev-cmd/update-portable-ruby_spec.rb |
Removes tests for the deleted dev-cmd. |
Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/update_portable_ruby.rbi |
Removes RBI for the deleted dev-cmd. |
.github/workflows/vendor-gems.yml |
Scopes app-token permissions and updates messaging to point to the new workflow. |
.github/workflows/bump-portable-ruby.yml |
New workflow to generate vendored portable-ruby updates and open an automated PR. |
Files not reviewed (1)
- Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/update_portable_ruby.rbi: Language not supported
Comments suppressed due to low confidence (2)
Library/Homebrew/test_bot/formulae.rb:836
Utils::PortableRubyis referenced here but there is norequire "utils/portable_ruby"intest_bot/formulae.rbor any upstreamrequire(a repo-wide search shows no requires). This will raiseuninitialized constant Utils::PortableRubywhen the portable-ruby validation path runs; add an explicit require in an appropriate entrypoint (e.g.test_bot.rbor this file).
test "brew", "vendor-install", "ruby"
bundler_version = Utils::PortableRuby.sync_bundler_version!(pkg_version)
test "brew", "vendor-gems", "--no-commit", "--update=--ruby,--bundler=#{bundler_version}"
test "brew", "typecheck", "--update"
Library/Homebrew/test_bot/formulae.rb:818
- This computes a SHA256 via
Digest::SHA256without requiringdigest/sha2. In the portable-ruby test-bot path, Digest may not have been loaded yet, causing aNameError. Consider using the existingPathname#sha256helper (bottle_file.sha256), which already does the necessary require and is used elsewhere in test-bot.
tag_symbol = tag_string.to_sym
bottle_tag = Utils::Bottles::Tag.from_symbol(tag_symbol)
sha256 = Digest::SHA256.file(bottle_file).hexdigest
version = pkg_version.split("_").first.to_s
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c3374c6 to
837bcc8
Compare
837bcc8 to
28674d3
Compare
After `brew bottle portable-ruby` succeeds, stage the just-built bottle into `HOMEBREW_CACHE`, swap in the vendored portable-ruby, and run the Homebrew/brew PR CI surface against it so issues are caught in the homebrew-core PR rather than the follow-up brew bump PR. Shared bundler-syncing logic lives in a small `Utils::PortableRuby` helper for reuse with the new `bump-portable-ruby` workflow.
28674d3 to
b0f0664
Compare
|
Not adding a new spec since we're inlining everything. |
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks, looking good, few more comments!
Rewrites `update-portable-ruby` as a single hidden command that reads the `portable-ruby` formula, writes vendor files, runs `brew vendor-install ruby`, then syncs `utils/ruby.sh`, vendored gems and RBI files via the new `Utils::PortableRuby.sync_bundler_version!` helper. Drops `--dry-run` and `--skip-vendor-install` and hides from `brew help` since this is now meant to be invoked from the homebrew-core bottle-publish workflow rather than by hand. Also scopes the `actions/create-github-app-token` permissions in `vendor-gems.yml` to `contents: write`.
b0f0664 to
ba52ece
Compare
brew lgtm(style, typechecking and tests) with your changes locally?Claude Opus 4.7 did the initial implementation. I performed manual review and testing. The validation suite itself has not been exercised end-to-end yet. Its first live run will be on the next
portable-rubybump.Adds Homebrew/brew PR-style validation (
style,typecheck,tests --online,tests --generic,update-test,test-bot --test-default-formula) to test-bot'sportable_formula!so aportable-rubybottle is verified against brew's own code in the homebrew-core PR before bottling, instead of on the follow-up brew bump PR.Consolidates
brew update-portable-rubyinto a single hidden one-shot command (read formula → write vendor files →vendor-install→ sync bundler/gems/RBIs) so the companion Homebrew/homebrew-core#284463 can call it frompublish-commit-bottles.ymlafter aportable-rubybottle is published.Also scopes
actions/create-github-app-tokenpermissions invendor-gems.yml.